package com.bestcem.xm.user.dao.mapper;

import com.bestcem.xm.user.entity.mysql.Role;
import com.bestcem.xm.user.entity.mysql.User;
import com.bestcem.xm.user.entity.pojo.GetAccountRoleDO;
import com.bestcem.xm.user.entity.pojo.UserRoleDO;
import com.bestcem.xm.user.entity.pojo.UserRoleGroupDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface XmUserRoleMapper {

    int deleteByPrimaryKey(String roleId);

    int insertSelective(Role role);

    Role selectByPrimaryKey(String roleId);

    int updateByPrimaryKeySelective(Role role);

    List<UserRoleDO> selectRoleByCondition(UserRoleDO roleDO);

    List<GetAccountRoleDO> getAccountRoleCount(@Param("roleId") String roleId, @Param("childrenAndSelfGroupIds") List<String> childrenAndSelfGroupIds, @Param("status") Integer status);

    List<UserRoleDO> getRoleListByIdList(@Param("roleIdList") List<String> roleIdList);

    /**
     * 根据角色id查询租户下的user_role和user_group信息
     *
     * @param orgId   租户id
     * @param roleIds 角色ids
     */
    List<UserRoleGroupDO> selectRoleGroupByRoleIds(@Param("orgId") String orgId, @Param("roleIds") List<String> roleIds);

    /**
     *
     */
    List<User> listUserIdAndRoleList(List<String> userIds);
}